using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using T2.Logging.Data.Controllers.Interfaces;
using T2.Logging.Data.Entities.Interfaces;
using T2.Logging.Business.Entities.Interfaces;
using T2.Logging.Business.Entities;
using T2.Logging.Data.Controllers;
using T2.Logging.Business.Builders.Interface;
using T2.Logging.Business.Translators;
using T2.Logging.Business.Entities.Search.Interfaces;
using T2.Logging.Data.Entities.Search.Interfaces;


//--Change Management Control - Log Builder  --**********************
//--Created By: trooks
//--Description: Log Builder Class
//--Created Date: 03/07/2013 10:05:36
//--*************************************************************

namespace T2.Logging.Business.Builders
{
	public partial class Log_Builder : ILog_builder 
	{
		
	public List<ILog_biz> BuildParts (ILog_biz _param)
	{
			ILog_biz temp = new Log_biz();
			ILogController cont = new LogController();
			List<ILog_biz> tempList = new List<ILog_biz>();
			List<ILog> tempData = new List<ILog>();
			switch (_param.Action)
			{
				case "GetOne":
				temp = LogTranslator.TranslateFromDataLayer(cont.Log_GetOne(LogTranslator.TranslateToDataLayer(_param)));
				tempList.Add(temp);
				return tempList;

				case "GetAll":
				tempData = cont.Log_GetAll(LogTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => LogTranslator.TranslateFromDataLayer(p)).Cast<ILog_biz>().ToList();
				return tempList;

				case "Application_Log_ByParent":
				tempData = cont.Application_Log_ByParent(LogTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => LogTranslator.TranslateFromDataLayer(p)).Cast<ILog_biz>().ToList();
				return tempList;

				case "LogCategory_Log_ByParent":
				tempData = cont.LogCategory_Log_ByParent(LogTranslator.TranslateToDataLayer(_param));
				tempList = tempData.Select(p => LogTranslator.TranslateFromDataLayer(p)).Cast<ILog_biz>().ToList();
				return tempList;

			}
			return tempList;
}
	public List<ILog_biz> BuildParts (ILogSearch_biz _param)
	{
			ILog_biz temp = new Log_biz();
			ILogController cont = new LogController();
			List<ILog_biz> tempList = new List<ILog_biz>();
			List<ILog> tempData = new List<ILog>();
			tempData = cont.Log_Search(LogTranslator.TranslateSearchToDataLayer(_param));
			tempList = tempData.Select(p => LogTranslator.TranslateFromDataLayer(p)).Cast<ILog_biz>().ToList();
			return tempList;

	}
		
	}
}
